package cn.wetcland.urban.admin.controller;

import cn.wetcland.urban.admin.service.UtAppealService;
import cn.wetcland.urban.common.AjaxResponse;
import cn.wetcland.urban.generator.domain.UtAppeal;
import cn.wetcland.urban.generator.dto.BaseConditionSearchDTO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/appeal")
public class AppealController {

    @Resource
    private UtAppealService appealService;

    @GetMapping("/appealList")
    public AjaxResponse appealList(BaseConditionSearchDTO searchDTO) {
        Page<UtAppeal> addressPage = appealService.appealList(searchDTO);
        return AjaxResponse.success(addressPage);
    }

    @PutMapping("/appealResolve/{appealId}")
    public AjaxResponse appealResolve(String appealResponse, @PathVariable Long appealId) {
        appealService.appealResolve(appealId, appealResponse);
        return AjaxResponse.success();
    }

    @DeleteMapping("/appealDelete/{appealId}")
    public AjaxResponse appealDelete(@PathVariable Long appealId) {
        appealService.appealDelete(appealId);
        return AjaxResponse.success();
    }

}
